<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>退换货管理</h2>

    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn btn-default" href="{:U('newreject')}">新增退换货</a>
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="b_date" class="text time" value="{:I('b_date')}" placeholder="请选择开始时间"   style="width:150px;" />
            </div>
            <div class="sleft">
                <input type="text" name="e_date" class="text time" value="{:I('e_date')}" placeholder="请选择结束时间"   style="width:150px;" />
            </div>
            <div class="sleft">
                <input type="text" name="buyer" class="search-input" value="{:I('buyer')}" placeholder="客户查询" />
            </div>
            <div class="sleft">
                <input type="text" name="pname" class="search-input" value="{:I('pname')}" placeholder="商品名称">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('rejectlist')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>


    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table>
            <thead>
                <tr>
                    <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                    <th>客户</th>
                    <th>商品名称(规格)</th>
                    <th>退货数量</th>
                    <th>退货时间</th>
                    <th>操作人</th>
                    <th>状态</th>
                </tr>
            </thead>
            <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr>
                            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
                            <!--<td><a href="{:U('storageIn')}&batchNo={$vo['batchNo']}">{$vo.batchNo}</a></td>-->
                            <td>{$vo.buyer}</td>
                            <td>{$vo.pname}({$vo.spec})</td>
                            <td>{$vo.num}</td>
                            <td>{$vo.createdAt|time_format}</td>
                            <td>{$vo.updateUser|get_username}</td>
                            <td>
                                <if condition="$vo['status'] eq 1000">
                                    <a href="{:U('reject/dealreject')}&id={$vo['id']}" class="btn btn-primary">未处理</a>
                                </if>
                                <if condition="$vo['status'] eq 2000">
                                    <a href="{:U('reject/detail')}&rejectid={$vo['id']}" class="btn" style="background: #FFF;border:1px solid #666;color:#000;">查看明细</a>
                                    <button class="btn btn-success">处理完成</button>
                                </if>
                            </td>
                        </tr>
                    </volist>
                <else/>
                    <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        $('.time').datetimepicker({
            format: 'Y-m-d H:i:00',
            lang: "ch",
            minView: 2,
            autoclose: true
        });
//        $('.time').datetimepicker();
        //搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
        //导航高亮
        highlight_subnav('{:U('Reject/rejectlist')}');
    </script>
</block>
